package com.jiyun.controller;


import com.jiyun.login.pojo.finance.Receivable;
import com.jiyun.login.pojo.finance.ReceivableVo;
import com.jiyun.result.Result;
import com.jiyun.service.IReceivableService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author author
 * @since 2025-02-12
 */
@RestController
@RequestMapping("/finance/receivable")
@Slf4j
public class ReceivableController {

    @Autowired
    private IReceivableService receivableService;


    @RequestMapping("/list")
    public Result list(){
        receivableService.lists();
    return Result.ok();
    }

    @RequestMapping("/findAll")
    public Result findAll(@RequestBody ReceivableVo receivableVo){
        return receivableService.findAll(receivableVo);
    }
    //修改
    @RequestMapping("updateReceivableById")
    public Result updateReceivableById(Receivable receivable){
        receivableService.updateById(receivable);
        return Result.ok();

    }
    @RequestMapping("gitById")
    public Result gitById(Integer id){
        log.info("id:{}",id);
        Receivable receivable = receivableService.getById(id);
        return Result.ok(receivable);
    }
    @RequestMapping("selectOne")
    public Result selectOne(String receivableNumber){
        log.info("receivableNumber:{}",receivableNumber);
        List<Receivable> receivable = receivableService.selelctOne(receivableNumber);
        return Result.ok(receivable);
    }


}
